#pragma once


#include <Ogre.h>
#include "BtOgrePG.h"
#include "BtOgreGP.h"
#include "BtOgreExtras.h"

using namespace Ogre;

#define BIT(x) (1<<(x))
enum collisiontypes {
    COL_NOTHING = 0, //<Collide with nothing
    COL_SHIP = BIT(0), //<Collide with ships
    COL_WALL = BIT(1), //<Collide with walls
    COL_PROJECTILE = BIT(2) //<Collide with Projectiles
};

class PhysicsManager : public Singleton<PhysicsManager>
{
public:
	PhysicsManager();
	~PhysicsManager();
    
    static PhysicsManager& getSingleton(void);
    static PhysicsManager* getSingletonPtr(void);

	void addPhysicsShip(btRigidBody* pObject);
	void addPhysicsProjectile(btRigidBody* pObject);

	void removePhysicsObject(btRigidBody* pObject);
	void PhysicsManager::updatePhysics(double timeSinceLastFrame);
	void phyWorldTickCallback(btDynamicsWorld *world, btScalar timeStep);

	//btDynamicsWorld *phyWorld;
	btDiscreteDynamicsWorld *phyWorld;
	int shipCollidesWith;
	int wallCollidesWith;
	int projectileCollidesWith;

private:
	
	   //PHYSICS
   btAxisSweep3 *mBroadphase;
   btDefaultCollisionConfiguration *mCollisionConfig;
   btCollisionDispatcher *mDispatcher;
   btSequentialImpulseConstraintSolver *mSolver;

   btDefaultMotionState* groundState;
	btCollisionShape *mGroundShape;
};

